#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>

char arr[100];
int n;

int Left(int x)
{
    int left = 0;
    char t;
    int i = x;
    while (arr[i] == 'w')
    {
        left++;
        i = (i - 1 + n) % n;
        if (i == x)
            return n;
    }
    t = arr[i];
    while (arr[i] == 'w' || arr[i] == t)
    {
        left++;
        i = (i - 1 + n) % n;
        if (i == x)
            return n;
    }
    return left;
}

int Right(int x)
{
    int right = 0;
    char t;
    int j = x + 1;
    while (arr[j] == 'w')
    {
        right++;
        j = (j + 1 + n) % n;
        if (j == x)
            return n;
    }
    t = arr[j];
    while (arr[j] == 'w' || arr[j] == t)
    {
        right++;
        j = (j + 1 + n) % n;
        if (j == x)
            return n;
    }
    return right;
}

int main()
{
    int max = 0,num;
    scanf("%s", arr);
    n = strlen(arr);
    for (int i = 0; i < n; i++)
    {
        num = Left(i) + Right(i);
        max = num > max ? num : max;
    }
    printf("%d", max);
    return 0;
}